// eslint-disable-next-line
import { UserLayout, BasicLayout } from '@/layouts'
import DemoRouter from './module/demo.config'
import SystemRouter from './module/system.config'
import AutoflowRouter from './module/autoflow.config'
import PersonalRouter from './module/personal.config'
import AutoformRouter from './module/autoform.config'
import CmsRouter from './module/cms.config'
import AccountRouter from './module/account.config'

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/home',
    children: [
      {
        path: '/home',
        name: 'home',
        hidden: true,
        component: () => import('@/views/Home'),
        meta: { title: '首页', keepAlive: false }
      },
      CmsRouter,
      AutoflowRouter,
      PersonalRouter,
      AutoformRouter,
      SystemRouter,
      DemoRouter,
      AccountRouter
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/Login')
      },
      {
        path: 'recover',
        name: 'recover',
        component: undefined
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/demo/exception/404')
  },
  {
    path: '/ifm',
    name: 'ifm',
    hidden: true,
    component: () => import('@/views/iframe/Index'),
    redirect: '/ifm/form',
    meta: { title: 'iframe', keepAlive: false },
    children: [
      {
        path: '/ifm/form',
        name: 'ifm-form',
        component: () => import('@/views/autoform/form/Index'),
        meta: { title: '表单管理', keepAlive: false }
      },
      {
        path: '/ifm/column',
        name: 'ifm-column',
        component: () => import('@/views/autoform/column/Index'),
        meta: { title: '字段管理', keepAlive: false }
      },
      {
        path: '/ifm/view',
        name: 'ifm-view',
        component: () => import('@/views/autoform/view/Index'),
        meta: { title: '视图管理', keepAlive: false }
      }
    ]
  }
]
